<template>
  <div id="app">
    <page-header :allList="allList" :countryList="countryList" :houseList="houseList" />
    <router-view/>
    <page-footer :allListBtm="allListBtm" :houseList="houseList" />
  </div>
</template>
<script>
  // import Vue from 'vue';
  import httpApi from '@/api/index'

  import PageHeader from "@/components/PageHeader.vue";
  import PageFooter from "@/components/PageFooter.vue";

  export default {
    data() {
      return {
        allList: [], // PC端
        countryList: [], // 移动端
        houseList: [], // 房产

        allListBtm: [],
      }
    },
    components: {
      'page-header': PageHeader,
      'page-footer': PageFooter,
    },
    mounted() {
      this.getAllList(); // 大洲and国家
      this.getHouseList() // 全部国家
    },
    methods: {
      getAllList(){
        httpApi.getcountry().then(res => {
          this.allList = res.data;
          this.allList.forEach(item => {
            if(item.countryList && item.continent.id > 0){
              item.countryList.forEach(aItem => {
                this.countryList.push(aItem);
              })
            }
          })

          this.allListBtm = res.data.slice(1);
        })
      },
      getHouseList(){
        // this.houseList = [];
        httpApi.getcountryAll().then(res => {
          let data = res.data;
          data.forEach(item => {
            if(item.id == 26 || item.id == 29 || item.id == 30){
              this.houseList.push(item)
            }
          });
        });
      },
    }
  }
</script>
<style lang="scss">
  @import "src/assets/css/index";
  @import "src/assets/css/base";
  @import "src/assets/css/common";
  @import "src/assets/css/tooltip";
  #app{
    overflow: hidden;
  }
</style>